What's the reason exceptions are heavily used in managed (C# and Java) languages but not in C++? [on hold]
Posted
by
ZijingWu
on Programmers
See other posts from Programmers
or by ZijingWu
Published on 2013-11-05T04:57:18Z
Indexed on
2013/11/06
16:11 UTC
Read the original article
Hit count: 219
AFAIK, a lot of C++ projects don't allow exceptions and deny them in coding guidelines. I have a lot of reasons, for example, exception is hard to handle correctly if your binary needs to be compiled by separate and different compilers.
But it doesn't fully convince me, there is a lot of projects which are just using one compiler. Compared to C++, exceptions are heavily used in C# and Java and the reason can only be that exception are not bringing enough benefit.
One point is debugbility in practice. Exception can not get the call stack in C++ code, but in C# and Java you can get the call stack from exception, it is significant and makes debugging easier. No-callstack is not the fault of the exception, it is the language difference, but it impacts the exception usage.
So what's the reason that exceptions are frowned upon in c++ programs?
© Programmers or respective owner